/**
 */
package wcomm_v1.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import wcomm_v1.ActivityDefinition;
import wcomm_v1.ComponentDefinition;
import wcomm_v1.Datatype;
import wcomm_v1.Import;
import wcomm_v1.Interface;
import wcomm_v1.ROOT;
import wcomm_v1.Service;
import wcomm_v1.Wcomm_v1Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>ROOT</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link wcomm_v1.impl.ROOTImpl#getImports <em>Imports</em>}</li>
 *   <li>{@link wcomm_v1.impl.ROOTImpl#getDatatypes <em>Datatypes</em>}</li>
 *   <li>{@link wcomm_v1.impl.ROOTImpl#getInterfaces <em>Interfaces</em>}</li>
 *   <li>{@link wcomm_v1.impl.ROOTImpl#getServices <em>Services</em>}</li>
 *   <li>{@link wcomm_v1.impl.ROOTImpl#getActivities <em>Activities</em>}</li>
 *   <li>{@link wcomm_v1.impl.ROOTImpl#getComponents <em>Components</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ROOTImpl extends EObjectImpl implements ROOT
{
  /**
   * The cached value of the '{@link #getImports() <em>Imports</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getImports()
   * @generated
   * @ordered
   */
  protected EList<Import> imports;

  /**
   * The cached value of the '{@link #getDatatypes() <em>Datatypes</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDatatypes()
   * @generated
   * @ordered
   */
  protected EList<Datatype> datatypes;

  /**
   * The cached value of the '{@link #getInterfaces() <em>Interfaces</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInterfaces()
   * @generated
   * @ordered
   */
  protected EList<Interface> interfaces;

  /**
   * The cached value of the '{@link #getServices() <em>Services</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getServices()
   * @generated
   * @ordered
   */
  protected EList<Service> services;

  /**
   * The cached value of the '{@link #getActivities() <em>Activities</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getActivities()
   * @generated
   * @ordered
   */
  protected EList<ActivityDefinition> activities;

  /**
   * The cached value of the '{@link #getComponents() <em>Components</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getComponents()
   * @generated
   * @ordered
   */
  protected EList<ComponentDefinition> components;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ROOTImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Wcomm_v1Package.Literals.ROOT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Import> getImports()
  {
    if (imports == null)
    {
      imports = new EObjectContainmentEList<Import>(Import.class, this, Wcomm_v1Package.ROOT__IMPORTS);
    }
    return imports;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Datatype> getDatatypes()
  {
    if (datatypes == null)
    {
      datatypes = new EObjectContainmentEList<Datatype>(Datatype.class, this, Wcomm_v1Package.ROOT__DATATYPES);
    }
    return datatypes;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Interface> getInterfaces()
  {
    if (interfaces == null)
    {
      interfaces = new EObjectContainmentEList<Interface>(Interface.class, this, Wcomm_v1Package.ROOT__INTERFACES);
    }
    return interfaces;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Service> getServices()
  {
    if (services == null)
    {
      services = new EObjectContainmentEList<Service>(Service.class, this, Wcomm_v1Package.ROOT__SERVICES);
    }
    return services;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<ActivityDefinition> getActivities()
  {
    if (activities == null)
    {
      activities = new EObjectContainmentEList<ActivityDefinition>(ActivityDefinition.class, this, Wcomm_v1Package.ROOT__ACTIVITIES);
    }
    return activities;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<ComponentDefinition> getComponents()
  {
    if (components == null)
    {
      components = new EObjectContainmentEList<ComponentDefinition>(ComponentDefinition.class, this, Wcomm_v1Package.ROOT__COMPONENTS);
    }
    return components;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ROOT__IMPORTS:
        return ((InternalEList<?>)getImports()).basicRemove(otherEnd, msgs);
      case Wcomm_v1Package.ROOT__DATATYPES:
        return ((InternalEList<?>)getDatatypes()).basicRemove(otherEnd, msgs);
      case Wcomm_v1Package.ROOT__INTERFACES:
        return ((InternalEList<?>)getInterfaces()).basicRemove(otherEnd, msgs);
      case Wcomm_v1Package.ROOT__SERVICES:
        return ((InternalEList<?>)getServices()).basicRemove(otherEnd, msgs);
      case Wcomm_v1Package.ROOT__ACTIVITIES:
        return ((InternalEList<?>)getActivities()).basicRemove(otherEnd, msgs);
      case Wcomm_v1Package.ROOT__COMPONENTS:
        return ((InternalEList<?>)getComponents()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ROOT__IMPORTS:
        return getImports();
      case Wcomm_v1Package.ROOT__DATATYPES:
        return getDatatypes();
      case Wcomm_v1Package.ROOT__INTERFACES:
        return getInterfaces();
      case Wcomm_v1Package.ROOT__SERVICES:
        return getServices();
      case Wcomm_v1Package.ROOT__ACTIVITIES:
        return getActivities();
      case Wcomm_v1Package.ROOT__COMPONENTS:
        return getComponents();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ROOT__IMPORTS:
        getImports().clear();
        getImports().addAll((Collection<? extends Import>)newValue);
        return;
      case Wcomm_v1Package.ROOT__DATATYPES:
        getDatatypes().clear();
        getDatatypes().addAll((Collection<? extends Datatype>)newValue);
        return;
      case Wcomm_v1Package.ROOT__INTERFACES:
        getInterfaces().clear();
        getInterfaces().addAll((Collection<? extends Interface>)newValue);
        return;
      case Wcomm_v1Package.ROOT__SERVICES:
        getServices().clear();
        getServices().addAll((Collection<? extends Service>)newValue);
        return;
      case Wcomm_v1Package.ROOT__ACTIVITIES:
        getActivities().clear();
        getActivities().addAll((Collection<? extends ActivityDefinition>)newValue);
        return;
      case Wcomm_v1Package.ROOT__COMPONENTS:
        getComponents().clear();
        getComponents().addAll((Collection<? extends ComponentDefinition>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ROOT__IMPORTS:
        getImports().clear();
        return;
      case Wcomm_v1Package.ROOT__DATATYPES:
        getDatatypes().clear();
        return;
      case Wcomm_v1Package.ROOT__INTERFACES:
        getInterfaces().clear();
        return;
      case Wcomm_v1Package.ROOT__SERVICES:
        getServices().clear();
        return;
      case Wcomm_v1Package.ROOT__ACTIVITIES:
        getActivities().clear();
        return;
      case Wcomm_v1Package.ROOT__COMPONENTS:
        getComponents().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.ROOT__IMPORTS:
        return imports != null && !imports.isEmpty();
      case Wcomm_v1Package.ROOT__DATATYPES:
        return datatypes != null && !datatypes.isEmpty();
      case Wcomm_v1Package.ROOT__INTERFACES:
        return interfaces != null && !interfaces.isEmpty();
      case Wcomm_v1Package.ROOT__SERVICES:
        return services != null && !services.isEmpty();
      case Wcomm_v1Package.ROOT__ACTIVITIES:
        return activities != null && !activities.isEmpty();
      case Wcomm_v1Package.ROOT__COMPONENTS:
        return components != null && !components.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //ROOTImpl
